{% extends "layout.njk" %}

{# 设置标题 #}
{% block title %}
    我的话题列表
{% endblock %}

{# 设置样式 #}
{% block css %}
    {{super()}}
{% endblock %}

{# 设置脚本 #}
{% block js %}
    {{super()}}
{% endblock %}

{# 设置主区域 #}
{% block main %}
    <div class="container">
        {% if topics %}
            <div class="row title">
                <div class="col-2">序号</div>
                <div class="col-6">标题</div>
                <div class="col-2">发布时间</div>
                <div class="col-2">操作</div>
            </div>
            {% for t in topics %}
                <div class="row item">
                    <div class="col-2">{{loop.index}}</div>
                    <div class="col-6">{{t.title}}</div>
                    <div class="col-2">{{t.time|dateformat}}</div>
                    <div class="col-2">
                        <a href="/topic/detail/{{t.id}}">详情</a>
                        <a href="/topic/edit/{{t.id}}">编辑</a>
                        <a href="/topic/remove/{{t.id}}">删除</a>
                    </div>
                </div>
            {% endfor %}
        {% else %}
            <h3>无话题</h3>
            <a href="/topic/publish">发布新话题</a>
        {% endif %}
    </div>
{% endblock %}